Smith Sphere

The smith chart is a nomogram used frequently in RF/Microwave Engineering. Since its inception it has been recognised that projecting the chart onto the reimen sphere [1].

[1]H. . Wheeler, “Reflection Charts Relating to Impedance Matching,” IEEE Transactions on Microwave Theory and Techniques, vol. 32, no. 9, pp. 1008–1021, Sep. 1984.


In [1]:
from IPython.display import SVG
SVG('pics/smith_sphere.svg')


Out[1]:
image/svg+xml Z-plane S-plane passive active capacitive inductive

In [17]:
from GA.ga import Ga

from sympy import * 

(ga,er,ex,es) = Ga.build('e_r e_x e_s',g=[1,1,1])
(gaz,zr,zx) = Ga.build('z_r z_x',g=[1,1])

Bz = er^ex # impedance plance 
Bs = es^ex # reflection coefficient plane
Bx = er^es # 
ZERO = er|ex # this is dumb
I = ga.I()

def down(p, N):
    '''
    stereographically project a vector in G3 downto the bivector N
    '''
    n= -1*N.dual()
    return -(n^p)*(n-n*(n|p)).inv() 

def up(p):
    '''
    stereographically project a vector in G2 upto the space G3
    '''
    if p^Bz == ZERO:
        N = Bz
    elif  p^Bs == ZERO:
        N = Bs
        
    n = -N.dual()
    
    return   n + 2*(p*p + 1).inv()*(p-n)
    
a,b,c,z,s,n = [ga.mv(k,'vector') for k in ['a','b','c','z','s' ,'n']]

Starting with an impedance vector $z$, defined by a vector in the impedance plane $B_z$, this vector has two scalar components ( $z^r$, $z^x$) known as resistance and reactance


In [18]:
Bz.dual()


Out[18]:
\begin{equation*} -1 \boldsymbol{e_{s}} \end{equation*}

In [19]:
z = z.proj([er,ex])
z


Out[19]:
\begin{equation*} z^{r} \boldsymbol{e_{r}} + z^{x} \boldsymbol{e_{x}} \end{equation*}

stereographically up-projecting this onto the sphere to point $p$,


In [20]:
p = up(z)
p


Out[20]:
\begin{equation*} \frac{2 z^{r}}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} \boldsymbol{e_{r}} + \frac{2 z^{x}}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} \boldsymbol{e_{x}} + \frac{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} - 1}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} \boldsymbol{e_{s}} \end{equation*}

In [21]:
p.norm2()


Out[21]:
\begin{equation*} 1 \end{equation*}

Stereographically down-projecting this back onto the impedance plane


In [22]:
down(p, Bz)


Out[22]:
\begin{equation*} z^{r} \boldsymbol{e_{r}} + z^{x} \boldsymbol{e_{x}} \end{equation*}

Rotating about the reactive plane


In [23]:
p= up(z)
R=((pi/4)*Bx).exp()

down(R*p*R.rev(),Bz)


Out[23]:
\begin{equation*} \frac{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} - 1}{{\left ( z^{r} \right )}^{2} + 2 z^{r} + {\left ( z^{x} \right )}^{2} + 1} \boldsymbol{e_{r}} + \frac{2 z^{x}}{{\left ( z^{r} \right )}^{2} + 2 z^{r} + {\left ( z^{x} \right )}^{2} + 1} \boldsymbol{e_{x}} \end{equation*}

In [25]:
(z-er)*(z+er).inv()


Out[25]:
\begin{equation*} \frac{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} - 1}{{\left ( z^{r} \right )}^{2} + 2 z^{r} + {\left ( z^{x} \right )}^{2} + 1} - \frac{2 z^{x}}{{\left ( z^{r} \right )}^{2} + 2 z^{r} + {\left ( z^{x} \right )}^{2} + 1} \boldsymbol{e_{r}\wedge e_{x}} \end{equation*}

In [26]:
p


Out[26]:
\begin{equation*} \frac{2 z^{r}}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} \boldsymbol{e_{r}} + \frac{2 z^{x}}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} \boldsymbol{e_{x}} + \frac{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} - 1}{{\left ( z^{r} \right )}^{2} + {\left ( z^{x} \right )}^{2} + 1} \boldsymbol{e_{s}} \end{equation*}

In [11]:
R*er*R.rev()


Out[11]:
\begin{equation*} -1 \boldsymbol{e_{s}} \end{equation*}

In [27]:
def z2p(z):
    z = real(z)*er+imag(z)*ex
    return up(z)
def p2z(p):
    z = down(p,Bz)
    return (er|z).scalar() + (ex|z).scalar()*1j

In [28]:
z = rand()+ rand()*1j
s = (z-1)/(z+1)
s


Out[28]:
(-0.4105211018197388+0.4168573043670432j)

In [33]:
p2z(R*z2p(z)*R.rev())


Out[33]:
-0.410521101819739 + 0.416857304367043*I

In [30]:
import skrf as rf
rf.zl_2_Gamma0(z0=1,zl=z)


Out[30]:
array([-0.4105211+0.4168573j])

In [15]: